using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Entities;
using BUS;
using Utility;

public partial class Admin_NhaSanXuatUpdate : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
        if (!IsPostBack)
        {
            LoadData();
        }
    }

    private void LoadData()
    {
        try
        {
            int iD = int.Parse(Request.QueryString["iD"].ToString());
            txt_mansx.Text = iD.ToString();
            tbNhaSX  nhasx = tbNhaSXBUS.GetByID(iD);
            txt_tennsx.Text=nhasx .TenNSX ;
            txt_diachi.Text=nhasx .DiaChi ;
            txt_dienthoai.Text=nhasx .DienThoai ;
        }
        catch
        {
            Response.Redirect("~/Admin/NhaSanXuatDanhSach.aspx");
        }
    }

    protected void btn_sua_Click(object sender, EventArgs e)
    {
        try
        {
            int iD = int.Parse(Request.QueryString["iD"]);
            tbNhaSX nhasx = tbNhaSXBUS.GetByID(iD);
            nhasx.TenNSX = txt_tennsx.Text;
            nhasx.DiaChi = txt_diachi.Text;
            nhasx.DienThoai = txt_dienthoai.Text;
            tbNhaSXBUS.Update(nhasx);
        }
        catch
        {

        }
        Response.Redirect("~/Admin/NhaSanXuatDanhSach.aspx");
        Response.Redirect(Request.RawUrl);
    }

}

